"""
# -*- coding: utf-8 -*-
# @Time    : 2023/5/28 20:05
# @Author  : 王摇摆
# @FileName: 8diexing.py
# @Software: PyCharm
# @Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
"""
import numpy as np
import matplotlib.pyplot as plt

def plot_butterfly(x, y, x_label, y_label, title):
    # 绘制蝶形运算的可视化图形
    plt.figure(figsize=(6, 4))
    plt.title(title)
    plt.xlabel(x_label)
    plt.ylabel(y_label)
    plt.axis('off')

    num_values = len(x)

    for i in range(num_values):
        plt.text(0, i, str(x[i]), va='center', ha='right')
        plt.text(1, i, str(y[i]), va='center', ha='left')
        plt.plot([0, 1], [i, i], 'k-')

    plt.ylim(-0.5, num_values - 0.5)
    plt.xlim(-0.5, 1.5)
    plt.show()

# 示例数据
x = [1, 3]
y = [2, 4]

# 绘制蝶形运算的可视化图形
plot_butterfly(x, y, "x", "y", "Butterfly Operation")
